package iotest.chario;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class FileReaderDemo {

	public static void main(String[] args) {
		fileReader();
	}
	

	private static void fileReader() {
		File file = new File("test.txt");
		
		FileReader fileReader = null;
		try {
			fileReader = new FileReader(file);
			char[] chars = new char[5];
			int len = 0; 
			while ((len = fileReader.read(chars))!=-1) {	
				System.out.print(new String(chars,0,len));
			}
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally {
			try {
				fileReader.close();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		
		
	}

}
